package com.aizhixin.quick.controller;


import com.aizhixin.quick.mapper.RoleMapper;
import com.aizhixin.quick.service.RoleService;
import com.aizhixin.quick.utils.Result;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-09
 */
@RestController
@Api(tags = "角色基础操作")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@RequestMapping("/role")
public class RoleController {

 @Autowired
 RoleMapper roleMapper;
 @Autowired
 RoleService roleService;

 /*
 新增角色
  */
@PostMapping("/saveRole")
 public Result saveRole(){
 roleService.save();
 return Result.ok();
}

/*
 根据 角色，名称 查询
  */
@GetMapping("/getRole")
 public Result getRole(){
 roleMapper.selectMaps();
 return  Result.ok();
}

 /*
 修改角色信息
  */
@PostMapping("/updateRole")
 public Result updateRole(){
 roleMapper.update();
 return Result.ok();
}

 /*
 根据id删除 角色信息
  */
@DeleteMapping("/deleteRoleByid")
 public Result deleteByid(){
 roleService.removeById();
 return Result.ok();
}
}

